﻿// -----------------------------------------------------------------------
// <copyright file="DepartmentManager.cs" company="">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace employee_test
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class DepartmentManager:EntityManager
    {
        public static List<Department> GetDepartments()
        {        
            List <Department>departments = Context.Departments.ToList<Department>();
            return departments;
        }

        public static void AddDepartment(string deptname)
        {
            Department dept = new Department();
            dept.DepartmentName = deptname;

            Context.Departments.InsertOnSubmit(dept);
            try
            {
                Context.SubmitChanges();
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                throw ex;

            }
        
        }


    }
}
